package cn.swust.designpatternlearningplatform.controller;

import cn.swust.designpatternlearningplatform.common.AnnotationUtils.Authentication;
import cn.swust.designpatternlearningplatform.common.Result.R;
import cn.swust.designpatternlearningplatform.domain.entity.About;
import cn.swust.designpatternlearningplatform.domain.enums.RoleEnum;
import cn.swust.designpatternlearningplatform.service.AboutService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/about")
@Authentication(RoleEnum.TEACHER)
@Slf4j
public class AboutController {
    @Resource
    private AboutService aboutService;
    @PostMapping("/add")
    public R addAbout(@RequestBody  About about){
        System.out.println(about);
       return aboutService.add(about);
    }

    @PostMapping("/update")
    public R update(About about){
        return aboutService.update(about);
    }

    @PostMapping ("/delete")
    public R delete(@RequestBody List<Integer> list){
        return aboutService.delete(list);
    }
}
